import 'package:chatgreat/helper/logger.dart';
import 'package:chatgreat/repo/api/creative.dart';
import 'package:chatgreat/repo/api_server.dart';
import 'package:get/get.dart';

import '../../../../repo/model/gallery_home_model.dart';

class GalleryHomeData {

  List<StyleList> styleList = [];
  List<SizeList> sizeList = [];

  var needIntegral = 0.obs;
  var integral = 0.obs;

  Future<bool> loadData() async {
    try {
      final resp = await APIServer().galleryImgHome();

      styleList.clear();
      styleList.addAll(resp.styleList ?? []);

      sizeList.clear();
      sizeList.addAll(resp.sizeList ?? []);

      needIntegral.value = resp.needIntegral ?? 0;
      integral.value = resp.integral ?? 0;

      return true;
    } catch (e) {
      Logger.instance.e(e);
      return false;
    }
  }
}
